loc <- filtered_dataset$location %>%
left_join(filtered_dataset$site_quali, by = "siteid") %>%
st_as_sf(coords = c("longitude", "latitude"),
crs = 4326)
fig_sites <- paste0(
"Australia absence because span is superior to 10 years of 100s of sites but number of samplings < 10.")
world <- ne_countries(scale = "medium", returnclass = "sf")
bb <- st_bbox(loc)
ggplot(data = world) +
geom_sf() +
geom_sf(data = loc, aes(color = protocol), shape = 1) +
theme(legend.position = "bottom") +
labs(title = paste0("Number of sites: ", nrow(loc)))
Figure 2.1: Australia absence because span is superior to 10 years of 100s of sites but number of samplings < 10.
We used also hill numbers with coverage-based correction proposed by (???)
Betadiversity metrics compares the composition of two communities. In our case, we compare the composition of each time step relatively to the baseline, i.e. the first year of sampling.
Relative abundance: \(SER_a = \dfrac{\sum_i (p_i - p^{\prime}_i)^2}{\sum_i p_i^2 + \sum_i p^{\prime2}_i - \sum_i p_i p^{\prime}_i}\)
\(J\): Jaccard index
Turnover metrics based on presence/absence can be decomposed in appearance/disappearance and nestedness / turnover.
appearance: \(\dfrac{S_{imm}}{S_{tot}}\), disappearance: \(\dfrac{S_{lost}}{S_{tot}}\)
Nestedness: \(SER_r - J_t\)
ti <- map_dfr(rigal_trends, ~tabyl_df(x = .x, group = "direction"),
.id = "response"
)
ti %>%
filter(direction != "Total") %>%
select(response, direction, percent) %>%
mutate(response = str_replace_all(response, get_var_replacement())) %>%
pivot_wider(names_from = "direction", values_from = "percent") %>%
kable() %>%
kable_styling(bootstrap_options = c("striped", "bordered", "hover"))
| response | stable | increase | decrease |
|---|---|---|---|
| Total abundance | 82.7% | 10.0% | 7.3% |
| Log Total Turnover (jaccard) (codyn) abundance | 80.6% | 11.8% | 7.6% |
| Species richness | 81.1% | 11.5% | 5.7% |
| Log species richness | 79.5% | 11.1% | 5.2% |
| Chao species richness | 83.2% | 9.4% | 6.1% |
| Chao Shannon | 80.7% | 9.8% | 5.7% |
| Chao Simpson | 81.7% | 8.8% | 5.8% |
| Chao Evenness | 85.1% | 6.3% | 4.9% |
| Jaccard (binary, similarity) | 80.8% | 2.4% | 13.3% |
| Horn (binary, similarity) | 80.8% | 2.3% | 13.3% |
| Chao (binary, similarity) | 68.0% | 2.7% | 8.2% |
| SER_a (rel abundance) | 81.0% | 3.2% | 13.8% |
| Total Turnover (jaccard) (codyn) | 77.7% | 13.7% | 2.3% |
| Appearance | 73.2% | 11.8% | 2.9% |
| disAppearance | 65.3% | 7.1% | 2.4% |
| Evenness | 82.5% | 7.6% | 6.2% |
| Shannon | 80.0% | 10.2% | 6.1% |
| Simpson | 81.5% | 9.0% | 5.8% |
| Jaccard (binary, dissimilarity) | 78.4% | 13.1% | 2.2% |
| Nestedness (jaccard) | 81.7% | 7.7% | 3.8% |
| Turnover (jaccard) | 57.6% | 6.3% | 1.9% |
ti <- map_dfr(rigal_trends, ~tabyl_df(x = .x, group = "shape_class"),
.id = "response"
)
ti %>%
filter(shape_class != "Total") %>%
select(response, shape_class, percent) %>%
mutate(response = str_replace_all(response, get_var_replacement())) %>%
pivot_wider(names_from = "shape_class", values_from = "percent") %>%
kable() %>%
kable_styling(bootstrap_options = c("striped", "bordered", "hover"))
| response | stable_constant | increase_constant | decrease_constant | stable_convex | stable_concave | decrease_decelerated | increase_accelerated | decrease_accelerated | increase_decelerated | NA_constant |
|---|---|---|---|---|---|---|---|---|---|---|
| Total abundance | 72.7% | 9.1% | 6.2% | 6.0% | 4.1% | 1.0% | 0.8% | 0.1% | 0.1% | NA |
| Log Total Turnover (jaccard) (codyn) abundance | 69.5% | 10.4% | 6.9% | 4.8% | 6.3% | 0.3% | 0.2% | 0.4% | 1.2% | 0.0% |
| Species richness | 70.7% | 9.5% | 4.8% | 4.3% | 6.0% | 0.7% | 0.8% | 0.3% | 1.1% | 1.8% |
| Log species richness | 69.3% | 9.3% | 4.4% | 3.4% | 6.9% | 0.5% | 0.7% | 0.3% | 1.1% | 4.3% |
| Chao species richness | 74.1% | 7.8% | 5.3% | 4.6% | 4.5% | 0.7% | 0.9% | 0.1% | 0.7% | 1.3% |
| Chao Shannon | 71.1% | 8.5% | 5.1% | 4.2% | 5.5% | 0.4% | 0.7% | 0.2% | 0.6% | 3.7% |
| Chao Simpson | 72.2% | 7.8% | 5.2% | 4.3% | 5.2% | 0.5% | 0.6% | 0.1% | 0.5% | 3.7% |
| Chao Evenness | 77.5% | 5.5% | 4.6% | 3.3% | 4.2% | 0.3% | 0.4% | 0.1% | 0.4% | 3.7% |
| Jaccard (binary, similarity) | 72.3% | 2.0% | 11.6% | 5.0% | 3.6% | 0.9% | 0.1% | 0.7% | 0.3% | 3.5% |
| Horn (binary, similarity) | 72.5% | 1.9% | 11.6% | 4.4% | 4.0% | 0.8% | 0.1% | 0.9% | 0.3% | 3.6% |
| Chao (binary, similarity) | 58.5% | 1.6% | 5.2% | 5.2% | 4.4% | 1.7% | 0.1% | 1.3% | 1.1% | 21.0% |
| SER_a (rel abundance) | 71.1% | 2.6% | 11.6% | 5.3% | 4.6% | 1.1% | 0.1% | 1.1% | 0.5% | 1.9% |
| Total Turnover (jaccard) (codyn) | 70.5% | 12.2% | 2.0% | 3.5% | 3.7% | 0.2% | 0.9% | 0.1% | 0.5% | 6.3% |
| Appearance | 66.6% | 10.1% | 2.5% | 3.0% | 3.6% | 0.3% | 1.1% | 0.1% | 0.6% | 12.1% |
| disAppearance | 58.8% | 6.1% | 2.0% | 3.6% | 2.8% | 0.4% | 0.6% | 0.1% | 0.4% | 25.1% |
| Evenness | 73.6% | 6.7% | 5.6% | 4.1% | 4.8% | 0.4% | 0.5% | 0.2% | 0.5% | 3.6% |
| Shannon | 70.3% | 8.9% | 5.6% | 4.0% | 5.7% | 0.3% | 0.6% | 0.2% | 0.7% | 3.7% |
| Simpson | 72.2% | 7.8% | 5.1% | 3.7% | 5.6% | 0.3% | 0.5% | 0.3% | 0.8% | 3.6% |
| Jaccard (binary, dissimilarity) | 70.6% | 11.6% | 1.9% | 3.2% | 4.5% | 0.2% | 0.7% | 0.1% | 0.8% | 6.3% |
| Nestedness (jaccard) | 74.6% | 6.2% | 3.3% | 3.6% | 3.6% | 0.4% | 0.8% | 0.1% | 0.6% | 6.8% |
| Turnover (jaccard) | 53.0% | 5.5% | 1.5% | 2.4% | 2.2% | 0.3% | 0.6% | 0.1% | 0.2% | 34.2% |
slope <- map_dfr(rigal_trends,
~.x %>%
select(siteid, linear_slope),
.id = "response"
)
rigal_trends_df <- map2_dfr(
rigal_trends, names(rigal_trends),
~.x %>% mutate(variable = .y)
) %>%
select(variable, siteid, linear_slope) %>%
pivot_wider(names_from = "variable", values_from = "linear_slope")
summary_slope <- slope %>%
group_by(response) %>%
summarise(summ = list(enframe(summary_distribution(linear_slope, na.rm = TRUE)))) %>%
unnest(cols = summ) %>%
pivot_wider(names_from = "name", values_from = "value") %>%
select(response, mean, median, sd)
summary_slope %>%
mutate(response = get_var_replacement()[response]) %>%
kable() %>%
kable_styling(bootstrap_options = c("striped", "bordered", "hover")) %>%
scroll_box(width = "100%", height = "1000px")
| response | mean | median | sd |
|---|---|---|---|
| Appearance | 0.0043083 | 0.0013017 | 0.0160590 |
| Chao (binary, similarity) | -0.0039328 | 0.0000000 | 0.0218819 |
| Chao evenness | 0.0021943 | 0.0000000 | 0.0869975 |
| Chao species richness | 0.0160926 | 0.0027879 | 0.1864729 |
| Chao shannon | 0.0109086 | 0.0033085 | 0.1104958 |
| Chao simpson | 0.0077291 | 0.0026013 | 0.0994345 |
| Disappearance | 0.0019926 | 0.0000000 | 0.0127173 |
| Evenness | 0.0010409 | 0.0000280 | 0.0185918 |
| SER_a (rel abundance) | -0.0082370 | -0.0035286 | 0.0273119 |
| Horn (binary, similarity) | -0.0052693 | -0.0032226 | 0.0184560 |
| Jaccard (binary, similarity) | -0.0066054 | -0.0041915 | 0.0211723 |
| Jaccard (binary, dissimilarity) | 0.0066054 | 0.0041915 | 0.0211723 |
| Log species richness | 0.5690175 | 0.1305570 | 3.5608475 |
| Log total abundance | 1.2164360 | 0.5582744 | 8.8216646 |
| Nestedness (jaccard) | 0.0029121 | 0.0001510 | 0.0211512 |
| Shannon | 0.0031355 | 0.0008848 | 0.0287062 |
| Simpson | 0.0013521 | 0.0002939 | 0.0142783 |
| Species richness | 0.0233072 | 0.0038939 | 0.1763604 |
| Total turnover (codyn) | 0.0063009 | 0.0038111 | 0.0197541 |
| Total abundance | 2.2395645 | 0.0955316 | 42.9647716 |
| Turnover (jaccard) | 0.0036933 | 0.0000000 | 0.0230755 |
p_jt_sup_ne <- sum(abs(rigal_trends_df$turnover) > abs(rigal_trends_df$nestedness)) /
nrow(rigal_trends_df)
rigal_trends_df %>%
ggplot(aes(x = jaccard , y = hillebrand)) +
geom_point() +
# geom_smooth(method = "gam") +
labs(x = "Jaccard trends (similarity, binary)", y = "Hillebrand trends
(similarity, relative abundance)")
rigal_trends_df_loc <- filtered_dataset$location %>%
left_join(rigal_trends_df, by = "siteid") %>%
st_as_sf(coords = c("longitude", "latitude"),
crs = 4326)
knitr::include_graphics(here("doc", "fig", "p_cor_slope_tot.png"))
ti <- expand.grid(
resp1 = unique(slope$response),
resp2 = unique(slope$response)
) %>%
filter(resp2 != resp1) %>%
filter(
resp1 %in% c("chao_richness", "species_nb", "log_species_nb",
"total_abundance", "log_total_abundance")) %>%
mutate_all(as.character) %>%
arrange(resp1)
test <- map2(ti$resp1, ti$resp2,
function(x, y) {
bi <- slope %>%
filter(response %in% c(x, y)) %>%
select(siteid, response, linear_slope) %>%
pivot_wider(names_from = "response", values_from = "linear_slope")
return(bi)
}
)
p_trends_trends <- map(test, function(x) {
l <- colnames(x)
x %>%
ggplot(aes(x = !!sym(l[2]), y = !!sym(l[3]))) +
geom_point() +
geom_smooth(method = "loess") +
labs(
x = get_var_replacement()[l[2]],
y = get_var_replacement()[l[3]]
)
})
names(p_trends_trends) <- map_chr(test, ~colnames(.x)[2])
plot_grid(
plotlist = p_trends_trends[names(p_trends_trends) %in% "log_species_nb"],
ncol = 3
)
#> `geom_smooth()` using formula 'y ~ x'
#> `geom_smooth()` using formula 'y ~ x'
#> `geom_smooth()` using formula 'y ~ x'
#> `geom_smooth()` using formula 'y ~ x'
#> `geom_smooth()` using formula 'y ~ x'
#> `geom_smooth()` using formula 'y ~ x'
#> `geom_smooth()` using formula 'y ~ x'
#> `geom_smooth()` using formula 'y ~ x'
#> `geom_smooth()` using formula 'y ~ x'
#> `geom_smooth()` using formula 'y ~ x'
#> `geom_smooth()` using formula 'y ~ x'
#> `geom_smooth()` using formula 'y ~ x'
#> `geom_smooth()` using formula 'y ~ x'
#> `geom_smooth()` using formula 'y ~ x'
#> `geom_smooth()` using formula 'y ~ x'
#> `geom_smooth()` using formula 'y ~ x'
#> `geom_smooth()` using formula 'y ~ x'
#> `geom_smooth()` using formula 'y ~ x'
Cf other document
library(ade4)
library(factoextra)
#> Welcome! Want to learn more? See two factoextra-related books at https://goo.gl/ve3WBa
tar_load(rigal_slp_df)
slope_df <- rigal_slp_df
res.pca <- dudi.pca(select(slope_df, -siteid),
scannf = FALSE, # Hide scree plot
nf = 5 # Number of components kept in the results
)
fviz_eig(res.pca)
p_pca <- map(list(c(1,2), c(2, 3), c(1, 3)),
~fviz_pca_var(res.pca,
axes = .x,
col.var = "contrib", # Color by contributions to the PC
gradient.cols = c("#00AFBB", "#E7B800", "#FC4E07"),
repel = TRUE # Avoid text overlapping
) +
theme(legend.position = "none") + labs(title = "")
)
plot_grid(plotlist = p_pca, ncol = 1)
#> Warning: ggrepel: 8 unlabeled data points (too many overlaps). Consider
#> increasing max.overlaps
tar_load(riveratlas_site)
riveratlas_site <- riveratlas_site %>%
mutate(across(starts_with("tmp_"), ~.x / 10))
riv <- riveratlas_site %>%
select(all_of(get_river_atlas_significant_var())) %>%
st_drop_geometry()
riv %>%
pivot_longer(cols = everything(), names_to = "variable", values_to = "values") %>%
ggplot(aes(x = values)) +
geom_histogram() +
facet_wrap(~variable, scales = "free_x")
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
pca_riv <- dudi.pca(df = scale(riv), scannf = FALSE, nf = 3)
fviz_eig(pca_riv)
p_pca <- map(list(c(1,2), c(2, 3), c(1, 3)),
~fviz_pca_var(pca_riv,
axes = .x,
col.var = "contrib", # Color by contributions to the PC
gradient.cols = c("#00AFBB", "#E7B800", "#FC4E07"),
repel = TRUE # Avoid text overlapping
) +
theme(legend.position = "none") + labs(title = "")
)
p_pca[[1]]
#> Warning: ggrepel: 5 unlabeled data points (too many overlaps). Consider
#> increasing max.overlaps
p_pca[[2]]
#> Warning: ggrepel: 6 unlabeled data points (too many overlaps). Consider
#> increasing max.overlaps
p_pca[[3]]
#> Warning: ggrepel: 4 unlabeled data points (too many overlaps). Consider
#> increasing max.overlaps
#### Environment - Trends
tar_load(slp_env)
slp_env_for_pca <- slp_env %>%
select(-all_of(c("siteid", "main_bas", "ecoregion", "geometry"))) %>%
rename(get_river_atlas_significant_var())
slp_env_for_pca$geometry <- NULL
pca_slp_env <- dudi.pca(
df = scale(na.omit(slp_env_for_pca)),
scannf = FALSE, nf = 3)
p_slp_env_pca <- map(list(c(1,2), c(2, 3), c(1, 3)),
~fviz_pca_var(pca_slp_env,
axes = .x,
col.var = "contrib", # Color by contributions to the PC
gradient.cols = c("#00AFBB", "#E7B800", "#FC4E07"),
repel = TRUE # Avoid text overlapping
) +
theme(legend.position = "none") + labs(title = "")
)
p_slp_env_pca[[1]]
#> Warning: ggrepel: 23 unlabeled data points (too many overlaps). Consider
#> increasing max.overlaps
p_slp_env_pca[[2]]
#> Warning: ggrepel: 19 unlabeled data points (too many overlaps). Consider
#> increasing max.overlaps
p_slp_env_pca[[3]]
#> Warning: ggrepel: 22 unlabeled data points (too many overlaps). Consider
#> increasing max.overlaps
paste0(var_temporal_trends,
" ~ ",
"dist_up_km + tmp_dc_cyr +
(1 + dist_up_km + tmp_dc_cyr | main_bas)"
) %>%
as.formula
library(spaMM)
#> Registered S3 methods overwritten by 'registry':
#> method from
#> print.registry_field proxy
#> print.registry_entry proxy
#> spaMM (Rousset & Ferdy, 2014, version 3.9.25) is loaded.
#> Type 'help(spaMM)' for a short introduction,
#> 'news(package='spaMM')' for news,
#> and 'citation('spaMM')' for proper citation.
tar_load(c(trend_env))
names(trend_env) <- var_temporal_trends
ti_trends <- map(var_temporal_trends,
~fitme(
as.formula(paste0("scale(", .x, ") ~ dist_up_km + tmp_c_cyr + (1 | main_bas)")),
data = slp_env[,
colnames(slp_env) %in%
c(.x, "siteid", "dist_up_km", "tmp_c_cyr", "main_bas", "ecoregion")
]
)
)
names(ti_trends) <- var_temporal_trends
ci <- map_dfr(ti_trends[names(ti_trends) %in% c("log_total_abundance", "log_species_nb", "jaccard",
"appearance", "disappearance", "turnover",
"nestedness", "hillebrand")], function(v) {
x <- confint(v, c("dist_up_km", "tmp_c_cyr"), verbose = FALSE)
tmp <- map_dfr(x, function(x) {
tm <- x$interval
names(tm) <- c("lower", "upper")
return(tm)
}, .id = "parm"
)
return(tmp)
}, .id = "response")
#> Iterative algorithm converges slowly.
#> Iterative algorithm converges slowly.
ci %>%
kable(.,
caption = "Confidence interval (bootstrap)")
| response | parm | lower | upper |
|---|---|---|---|
| log_total_abundance | dist_up_km | 0.0001544 | 0.0004751 |
| log_total_abundance | tmp_c_cyr | -0.0124125 | 0.0108759 |
| log_species_nb | dist_up_km | 0.0000083 | 0.0003255 |
| log_species_nb | tmp_c_cyr | 0.0044921 | 0.0297051 |
| jaccard | dist_up_km | 0.0001336 | 0.0004517 |
| jaccard | tmp_c_cyr | -0.0262087 | -0.0012096 |
| hillebrand | dist_up_km | 0.0000493 | 0.0003720 |
| hillebrand | tmp_c_cyr | -0.0283098 | -0.0062380 |
| appearance | dist_up_km | -0.0002093 | 0.0000992 |
| appearance | tmp_c_cyr | -0.0035101 | 0.0237618 |
| disappearance | dist_up_km | -0.0004606 | -0.0001410 |
| disappearance | tmp_c_cyr | -0.0086671 | 0.0101726 |
| nestedness | dist_up_km | -0.0002258 | 0.0000962 |
| nestedness | tmp_c_cyr | -0.0090806 | 0.0150305 |
| turnover | dist_up_km | -0.0003523 | -0.0000345 |
| turnover | tmp_c_cyr | -0.0015705 | 0.0162845 |
from_data_to_predict <- function(
model_list = NULL,
dataset = NULL,
re = NULL
) {
pred <- na.omit(dataset)
for (i in seq_along(names(model_list))) {
tmp <- predict(model_list[[i]],
re.form = as.formula(re),
intervals = "predVar"
)[,1]
names(tmp) <- NULL
pred[[names(model_list)[i]]] <- tmp
}
return(pred)
}
xx <- list(
tmp_c_cyr = seq(min(na.omit(slp_env$tmp_c_cyr)), max(na.omit(slp_env$tmp_c_cyr)), length.out = 10),
dist_up_km = seq(min(na.omit(slp_env$dist_up_km)), max(na.omit(slp_env$dist_up_km)), length.out = 10),
main_bas = unique(na.omit(slp_env$main_bas))
)
new_data <- expand.grid(xx) %>%
as_tibble()
pred <- predict(ti_trends[[1]], newdata = new_data, re.form = re, intervals="predVar")
int <- cbind(pred[,1], attr(pred, "intervals")) %>%
as_tibble() %>%
rename(y = V1)
xxx <- cbind(int, new_data) %>%
as_tibble
xxx %>%
ggplot(aes(y = y, x = dist_up_km, color = main_bas)) +
geom_point() +
theme(legend.position = "none")
re <- paste0("~ tmp_c_cyr + (1 | main_bas)")
pred_tmp <- from_data_to_predict(
model_list = ti_trends,
dataset = slp_env,
re = re
)
#>
|
| | 0%
|
|ssssssssssssssssssssssssss | 41%
|
|ssssssssssssssssssssssssssssssssssssssssssssssssssss | 81%
|
|ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss| 100%
#>
|
| | 0%
|
|ssssssssssssssssssssssssss | 41%
|
|ssssssssssssssssssssssssssssssssssssssssssssssssssss | 81%
|
|ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss| 100%
#>
|
| | 0%
|
|ssssssssssssssssssssssssss | 41%
|
|ssssssssssssssssssssssssssssssssssssssssssssssssssss | 81%
|
|ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss| 100%
#>
|
| | 0%
|
|ssssssssssssssssssssssssss | 41%
|
|ssssssssssssssssssssssssssssssssssssssssssssssssssss | 81%
|
|ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss| 100%
#>
|
| | 0%
|
|ssssssssssssssssssssssssss | 41%
|
|ssssssssssssssssssssssssssssssssssssssssssssssssssss | 81%
|
|ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss| 100%
#>
|
| | 0%
|
|ssssssssssssssssssssssssss | 41%
|
|ssssssssssssssssssssssssssssssssssssssssssssssssssss | 81%
|
|ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss| 100%
#>
|
| | 0%
|
|ssssssssssssssssssssssssss | 41%
|
|ssssssssssssssssssssssssssssssssssssssssssssssssssss | 81%
|
|ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss| 100%
#>
|
| | 0%
|
|ssssssssssssssssssssssssss | 41%
|
|ssssssssssssssssssssssssssssssssssssssssssssssssssss | 81%
|
|ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss| 100%
#>
|
| | 0%
|
|ssssssssssssssssssssssssss | 41%
|
|ssssssssssssssssssssssssssssssssssssssssssssssssssss | 81%
|
|ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss| 100%
#>
|
| | 0%
|
|ssssssssssssssssssssssssss | 41%
|
|ssssssssssssssssssssssssssssssssssssssssssssssssssss | 81%
|
|ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss| 100%
#>
|
| | 0%
|
|ssssssssssssssssssssssssss | 41%
|
|ssssssssssssssssssssssssssssssssssssssssssssssssssss | 81%
|
|ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss| 100%
#>
|
| | 0%
|
|ssssssssssssssssssssssssss | 41%
|
|ssssssssssssssssssssssssssssssssssssssssssssssssssss | 81%
|
|ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss| 100%
#>
|
| | 0%
|
|ssssssssssssssssssssssssss | 41%
|
|ssssssssssssssssssssssssssssssssssssssssssssssssssss | 81%
|
|ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss| 100%
#>
|
| | 0%
|
|ssssssssssssssssssssssssss | 41%
|
|ssssssssssssssssssssssssssssssssssssssssssssssssssss | 81%
|
|ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss| 100%
#>
|
| | 0%
|
|ssssssssssssssssssssssssss | 41%
|
|ssssssssssssssssssssssssssssssssssssssssssssssssssss | 81%
|
|ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss| 100%
#>
|
| | 0%
|
|ssssssssssssssssssssssssss | 41%
|
|ssssssssssssssssssssssssssssssssssssssssssssssssssss | 81%
|
|ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss| 100%
#>
|
| | 0%
|
|ssssssssssssssssssssssssss | 41%
|
|ssssssssssssssssssssssssssssssssssssssssssssssssssss | 81%
|
|ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss| 100%
#>
|
| | 0%
|
|ssssssssssssssssssssssssss | 41%
|
|ssssssssssssssssssssssssssssssssssssssssssssssssssss | 81%
|
|ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss| 100%
#>
|
| | 0%
|
|ssssssssssssssssssssssssss | 41%
|
|ssssssssssssssssssssssssssssssssssssssssssssssssssss | 81%
|
|ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss| 100%
#>
|
| | 0%
|
|ssssssssssssssssssssssssss | 41%
|
|ssssssssssssssssssssssssssssssssssssssssssssssssssss | 81%
|
|ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss| 100%
#>
|
| | 0%
|
|ssssssssssssssssssssssssss | 41%
|
|ssssssssssssssssssssssssssssssssssssssssssssssssssss | 81%
|
|ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss| 100%
p_tmp <- map(
c(
"log_total_abundance", "log_species_nb", "jaccard",
"appearance", "disappearance", "turnover",
"nestedness", "hillebrand"),
function(x) {
pred_tmp %>%
ggplot(aes(
y = !!sym(x),
x = tmp_c_cyr,
color = main_bas
)) +
geom_line() +
theme(legend.position = "none")
}
)
plot_grid(plotlist = p_tmp, ncol = 3)
re <- paste0("~ dist_up_km + (1 | main_bas)")
pred <- na.omit(slp_env)
for (i in seq_along(var_temporal_trends)) {
tmp <- predict(trend_env[[i]],
re.form = as.formula(re)
)[, 1]
names(tmp) <- NULL
pred[[var_temporal_trends[i]]] <- tmp
}
p <- map(
c("log_total_abundance", "log_species_nb", "jaccard",
"appearance", "disappearance", "turnover",
"nestedness", "hillebrand"),
function(x) {
pred %>%
ggplot(aes(
y = !!sym(x),
x = dist_up_km,
color = as.factor(main_bas),
shape = as.factor(ecoregion)
)) +
geom_line() +
theme(legend.position = "none")
}
)
plot_grid(plotlist = p, ncol = 3)
re <- paste0("~ tmp_dc_cyr + (1 | main_bas)")
pred_tmp <- from_data_to_predict(
model_list = trend_env,
dataset = slp_env,
re = re
)
p_tmp <- map(
c("log_species_nb", "jaccard", "appearance", "disappearance", "turnover", "hillebrand"),
function(x) {
pred_tmp %>%
ggplot(aes(
y = !!sym(x),
x = tmp_dc_cyr,
color = as.factor(main_bas)
)) +
geom_line() +
theme(legend.position = "none")
}
)
plot_grid(plotlist = p_tmp, ncol = 3)
re <- paste0("~ dist_up_km + (1 + dist_up_km | ecoregion)")
pred_dist_ecoregion <- from_data_to_predict(
model_list = trend_env,
dataset = slp_env,
re = re
)
p_dist_ecoregion <- map(
c("log_species_nb", "jaccard", "appearance", "disappearance", "turnover", "hillebrand"),
function(x) {
pred_dist_ecoregion %>%
ggplot(aes(
y = !!sym(x),
x = dist_up_km,
color = as.factor(ecoregion)
)) +
geom_line() +
theme(legend.position = "none")
}
)
plot_grid(plotlist = p_dist_ecoregion, ncol = 3)
re <- paste0("~ tmp_dc_cyr + (1 + tmp_dc_cyr | ecoregion)")
pred_tmp_ecoregion <- from_data_to_predict(
model_list = trend_env,
dataset = slp_env,
re = re
)
p_tmp_ecoregion <- map(
c("log_species_nb", "jaccard", "appearance", "disappearance", "turnover", "hillebrand"),
function(x) {
pred_tmp_ecoregion %>%
ggplot(aes(
y = !!sym(x),
x = tmp_dc_cyr,
color = as.factor(main_bas)
)) +
geom_line() +
theme(legend.position = "none")
}
)
plot_grid(plotlist = p_tmp_ecoregion, ncol = 3)
Reproducibility receipt
## datetime
Sys.time()
#> [1] "2022-02-03 09:57:32 CST"
## repository
if(requireNamespace('git2r', quietly = TRUE)) {
git2r::repository()
} else {
c(
system2("git", args = c("log", "--name-status", "-1"), stdout = TRUE),
system2("git", args = c("remote", "-v"), stdout = TRUE)
)
}
#> Local: main /home/alain/Documents/post-these/isu/RivFishTimeBiodiversityFacets
#> Head: [3deb541] 2022-02-02: spamm model basin as factor
## session info
sessionInfo()
#> R version 4.0.5 (2021-03-31)
#> Platform: x86_64-pc-linux-gnu (64-bit)
#> Running under: Debian GNU/Linux 10 (buster)
#>
#> Matrix products: default
#> BLAS: /home/alain/.Renv/versions/4.0.5/lib/R/lib/libRblas.so
#> LAPACK: /home/alain/.Renv/versions/4.0.5/lib/R/lib/libRlapack.so
#>
#> locale:
#> [1] LC_CTYPE=fr_FR.UTF-8 LC_NUMERIC=C
#> [3] LC_TIME=fr_FR.UTF-8 LC_COLLATE=fr_FR.UTF-8
#> [5] LC_MONETARY=fr_FR.UTF-8 LC_MESSAGES=fr_FR.UTF-8
#> [7] LC_PAPER=fr_FR.UTF-8 LC_NAME=C
#> [9] LC_ADDRESS=C LC_TELEPHONE=C
#> [11] LC_MEASUREMENT=fr_FR.UTF-8 LC_IDENTIFICATION=C
#>
#> attached base packages:
#> [1] parallel stats graphics grDevices utils datasets methods
#> [8] base
#>
#> other attached packages:
#> [1] spaMM_3.9.25 cachem_1.0.4
#> [3] memoise_2.0.0 factoextra_1.0.7
#> [5] ade4_1.7-16 inlatools_0.0.1.9001
#> [7] INLA_21.11.22 sp_1.4-5
#> [9] foreach_1.5.1 Matrix_1.3-2
#> [11] future_1.21.0 slider_0.2.2
#> [13] vegan_2.5-7 lattice_0.20-41
#> [15] permute_0.9-5 codyn_2.0.5
#> [17] janitor_2.1.0 viridis_0.5.1
#> [19] viridisLite_0.3.0 cowplot_1.1.1
#> [21] terra_1.4-22 rnaturalearthdata_0.1.0
#> [23] rnaturalearth_0.1.0 sf_1.0-4
#> [25] scales_1.1.1 kableExtra_1.3.1
#> [27] here_1.0.1 lubridate_1.7.9.2
#> [29] magrittr_2.0.1 forcats_0.5.1
#> [31] stringr_1.4.0 dplyr_1.0.4
#> [33] purrr_0.3.4 readr_2.1.1
#> [35] tidyr_1.1.2 tibble_3.1.6
#> [37] ggplot2_3.3.3 tidyverse_1.3.0
#> [39] tarchetypes_0.3.2 targets_0.8.1
#> [41] conflicted_1.1.0 rmarkdown_2.11
#> [43] nvimcom_0.9-123
#>
#> loaded via a namespace (and not attached):
#> [1] readxl_1.3.1 backports_1.2.1 igraph_1.2.6
#> [4] splines_4.0.5 listenv_0.8.0 digest_0.6.27
#> [7] htmltools_0.5.1.1 fansi_0.5.0 cluster_2.1.1
#> [10] tzdb_0.2.0 openxlsx_4.2.3 globals_0.14.0
#> [13] modelr_0.1.8 prettyunits_1.1.1 colorspace_2.0-0
#> [16] rvest_0.3.6 ggrepel_0.9.1 warp_0.2.0
#> [19] haven_2.3.1 xfun_0.28 callr_3.7.0
#> [22] crayon_1.4.2 jsonlite_1.7.2 iterators_1.0.13
#> [25] glue_1.5.1 registry_0.5-1 gtable_0.3.0
#> [28] webshot_0.5.2 car_3.0-10 abind_1.4-5
#> [31] DBI_1.1.1 rstatix_0.7.0 Rcpp_1.0.6
#> [34] progress_1.2.2 units_0.6-7 proxy_0.4-25
#> [37] foreign_0.8-81 httr_1.4.2 wk_0.5.0
#> [40] ellipsis_0.3.2 pkgconfig_2.0.3 farver_2.0.3
#> [43] sass_0.3.1 dbplyr_2.1.0 utf8_1.2.2
#> [46] tidyselect_1.1.1 labeling_0.4.2 rlang_0.4.12
#> [49] munsell_0.5.0 cellranger_1.1.0 tools_4.0.5
#> [52] cli_3.1.0 generics_0.1.0 broom_0.7.4
#> [55] evaluate_0.14 fastmap_1.1.0 yaml_2.2.1
#> [58] processx_3.5.2 knitr_1.36 fs_1.5.1
#> [61] zip_2.1.1 s2_1.0.7 pbapply_1.5-0
#> [64] nlme_3.1-152 slam_0.1-49 ROI_1.0-0
#> [67] xml2_1.3.2 compiler_4.0.5 rstudioapi_0.13
#> [70] curl_4.3.2 e1071_1.7-4 ggsignif_0.6.1
#> [73] reprex_1.0.0 bslib_0.2.4 stringi_1.7.6
#> [76] highr_0.9 ps_1.6.0 rgeos_0.5-5
#> [79] nloptr_1.2.2.2 classInt_0.4-3 vctrs_0.3.8
#> [82] pillar_1.6.4 lifecycle_1.0.1 jquerylib_0.1.3
#> [85] data.table_1.13.6 R6_2.5.1 bookdown_0.24
#> [88] KernSmooth_2.23-18 gridExtra_2.3 rio_0.5.16
#> [91] parallelly_1.23.0 codetools_0.2-18 boot_1.3-27
#> [94] MASS_7.3-53.1 assertthat_0.2.1 rprojroot_2.0.2
#> [97] withr_2.4.3 mgcv_1.8-34 hms_1.1.1
#> [100] grid_4.0.5 minqa_1.2.4 class_7.3-18
#> [103] snakecase_0.11.0 carData_3.0-4 git2r_0.29.0
#> [106] ggpubr_0.4.0 numDeriv_2016.8-1.1
Barnagaud, Jean-Yves, Pierre Gaüzère, Benjamin Zuckerberg, Karine Princé, and Jens-Christian Svenning. 2017. “Temporal Changes in Bird Functional Diversity Across the United States.” Oecologia 185 (4): 737–48. https://doi.org/10.1007/s00442-017-3967-4.
Blowes, Shane A., Sarah R. Supp, Laura H. Antão, Amanda Bates, Helge Bruelheide, Jonathan M. Chase, Faye Moyes, et al. 2019. “The Geography of Biodiversity Change in Marine and Terrestrial Assemblages.” Science 366 (6463): 339–45. https://doi.org/10.1126/science.aaw1620.
Dornelas, Maria, Nicholas J. Gotelli, Brian McGill, Hideyasu Shimadzu, Faye Moyes, Caya Sievers, and Anne E. Magurran. 2014. “Assemblage Time Series Reveal Biodiversity Change but Not Systematic Loss.” Science 344 (6181): 296–99. https://doi.org/10.1126/science.1248484.
Hillebrand, Helmut, Bernd Blasius, Elizabeth T. Borer, Jonathan M. Chase, John A. Downing, Britas Klemens Eriksson, Christopher T. Filstrup, et al. 2018. “Biodiversity Change Is Uncoupled from Species Richness Trends: Consequences for Conservation and Monitoring.” Journal of Applied Ecology 55 (1): 169–84. https://doi.org/https://doi.org/10.1111/1365-2664.12959.
Klink, Roel van, Diana E. Bowler, Konstantin B. Gongalsky, Ann B. Swengel, Alessandro Gentile, and Jonathan M. Chase. 2020. “Meta-Analysis Reveals Declines in Terrestrial but Increases in Freshwater Insect Abundances.” Science 368 (6489): 417–20. https://doi.org/10.1126/science.aax9931.
Mouchet, Maud A., Sébastien Villéger, Norman W. H. Mason, and David Mouillot. 2010. “Functional Diversity Measures: An Overview of Their Redundancy and Their Ability to Discriminate Community Assembly Rules.” Functional Ecology 24 (4): 867–76. https://doi.org/10.1111/j.1365-2435.2010.01695.x.
Soininen, Janne, Sophia Passy, and Helmut Hillebrand. 2012. “The Relationship Between Species Richness and Evenness: A Meta-Analysis of Studies Across Aquatic Ecosystems.” Oecologia 169 (3): 803–9. https://doi.org/10.1007/s00442-011-2236-1.
Vellend, Mark, Lander Baeten, Isla H. Myers-Smith, Sarah C. Elmendorf, Robin Beauséjour, Carissa D. Brown, Pieter De Frenne, Kris Verheyen, and Sonja Wipf. 2013. “Global Meta-Analysis Reveals No Net Change in Local-Scale Plant Biodiversity over Time.” Proceedings of the National Academy of Sciences 110 (48): 19456–9.